package com.tourism.config.handler;

/**
 * @Description 没有权限, 被拒绝访问时的调用类
 * @Author z
 * @Date 2021-03-09 22:58
 */

import com.tourism.util.ServletUtils;
import com.tourism.util.common.Response;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.web.access.AccessDeniedHandler;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Component
public class CustomerRestAccessDeniedHandler implements AccessDeniedHandler {

    @Override
    public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) {

        ServletUtils.render(response, Response.error("没有权限"));
    }

}
